<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
<title> 鼠标移入移出时改变图片透明度</title>
</head>

<body>
<script type="text/javascript">
    function visible(cursor,i){ //定义visible()函数
        if (i==0) //如果参数i的值为0
            cursor.style.opacity=1; //将图片不透明度设置为1
        else
            cursor.style.opacity=0.5;//将图片不透明度设置为0.5
    }
</script>
<img src="images/Temp.jpg" onMouseOver="visible(this,1)" onMouseOut="visible(this,0)">
</body>
</html>
